﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using ERP_RORZE_PERMISSION.Base;
using ERP_RORZE_PRODUCT.Product.DAO;

namespace ERP_RORZE_PRODUCT.Product.XLBM
{
    public partial class frm_MeMaEdit : DevExpress.XtraEditors.XtraForm
    {
        ClsXLBM clsXLBM = new ClsXLBM();
        public event EventHandler Reload;
        private LogUtils log;

        public string Some;

        public frm_MeMaEdit()
        {
            InitializeComponent();
            log = new LogUtils();
        }

        private void btnExit_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnEdit_Click(object sender, EventArgs e)
        {
            if (txtSome.Text == "")
            {
                MessageBox.Show("Chưa nhập Some");
            }
            else
            {
                clsXLBM.UpdateMeMa(txtSome.Text,Some, int.Parse(txtNumber.Text));

                //write Log
                log.Table = LogConstant.Table.Product.MeMa;
                log.Task = LogConstant.Task.Update;
                log.Description = "Some: " + txtSome.Text;
                log.WriteLog();

                Reload(sender, e);
            }
        }

        private void frm_MeMaEdit_Load(object sender, EventArgs e)
        {
            txtSome.Text = Some;
        }
    }
}